﻿using System;
using System.Data;
using System.Text;
using SME.Food.Surperise.BLL;

namespace SME.Food.Tricon.Web.AdminJS.MemberManage
{
    public partial class MemberList : System.Web.UI.Page
    {
        private Bas_Member_BLL bll = new Bas_Member_BLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            GetSingleSearch();
            BindData();
        }

        public void GetSingleSearch()
        {
            MemberSex = Request.Form["MemberSex"];
            SearchIdCardsNum = Request.Form["SearchIdCardsNum"];
            SearchMemName = Request.Form["SearchMemName"];
        }

        public void BindData()
        {
            StringBuilder sqlWhere =new StringBuilder()  ;
            if (!string.IsNullOrEmpty(SearchMemName))
            {
                sqlWhere.AppendFormat(" and Mem_Name like '%{0}%'", SearchMemName);
            }
            if (!string.IsNullOrEmpty(MemberSex))
            {
                sqlWhere.AppendFormat(" and Mem_Sex={0}",Int32.Parse(MemberSex));
            }
            if (!string.IsNullOrEmpty(SearchIdCardsNum))
            {
                sqlWhere.AppendFormat(" and Mem_Card like '%{0}%'", SearchIdCardsNum);
            }

             Table= bll.GetList(sqlWhere.ToString()).Tables[0];

        }

        /// <summary>
        /// 性别检索
        /// </summary>
        public string MemberSex { get; set; } 
        /// <summary>
        /// 身份证检索
        /// </summary>
        public string SearchIdCardsNum { get; set; }
        
        /// <summary>
        /// 员工姓名检索
        /// </summary>
        public string SearchMemName { get; set; }
        /// <summary>
        /// 是否到期
        /// </summary>
        public string PageNum { get; set; }
        /// <summary>
        /// 企业编号
        /// </summary>
        public string NumPerPage { get; set; }
        /// <summary>
        /// 企业名称
        /// </summary>
        public DataTable Table { get; set; }
    }
}